import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        name: 'layout',
        redirect: "/schoolDetail",
        component: () => import('../views/layout/index.vue'),
        children: [
            {
                path: 'schoolDetail',
                name: 'schoolDetail',
                component: () => import('@/views/layout/pages/schoolDetail/index.vue')
            },
            {
                path: 'schoolSingUp',
                name: 'schoolSingUp',
                component: () => import('@/views/layout/pages/schoolSingUp/index.vue')
            },
        ]
    },
    {
        path: '/login',
        name: 'login',
        component: () => import('../views/login/index.vue')
    }
];

const router = new VueRouter({
    routes,
    mode: "history"
});


const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push (location) {
    return originalPush.call(this, location).catch(err => err);
};

export default router;
